<template>
  <div class="index.vue">
    <div class="w">
      <div class="brief_content_box">
        <div class="brief_content_right">
          <div>
            <crumbs
              :padd="'0'"
              @handSonNav="handSonNav"
              :navList='navList'
            >
              <busNews
                @handSonNav="handSonNav"
                :sonList="sonList"
                v-if="id1==activeId"
                :count="count"
              ></busNews>
              <mediaFocus
                :sonList="sonList"
                v-if="id2==activeId"
                :count="count"
              ></mediaFocus>
              <setUp
                :sonList="sonList"
                v-if="id3==activeId"
                :count="count"
              ></setUp>
              <buSsafety
                :sonList="sonList"
                v-if="id4==activeId"
                :count="count"
              ></buSsafety>
              <busPositive
                :sonList="sonList"
                v-if="id5==activeId"
                :count="count"
              ></busPositive>
              <busElegant
                :sonList="sonList"
                v-if="id6==activeId"
                :count="count"
              ></busElegant>
              <busDongtai
                :sonList="sonList"
                v-if="id7==activeId"
                :count="count"
              ></busDongtai>
              <busBasic
                :sonList="sonList"
                v-if="id8==activeId"
                :count="count"
              ></busBasic>
              <busInform
                :sonList="sonList"
                v-if="id9==activeId"
                :count="count"
              ></busInform>
            </crumbs>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import zdyBtn from "@/components/zdyBtn.vue";
import rightNav from "@/components/rightNav.vue";
import crumbs from "@/components/crumbs.vue";
import busNews from "./components/busNews";
import mediaFocus from "./components/mediaFocus";
import setUp from "./components/setUp";
import busElegant from "./components/busElegant";
import busPositive from "./components/busPositive";
import buSsafety from "./components/buSsafety";
import busDongtai from "./components/busDongtai";
import busBasic from "./components/busBasic";
import busInform from "./components/busInform";
export default {
  components: {
    zdyBtn,
    rightNav,
    crumbs,
    busNews,
    mediaFocus,
    setUp,
    busElegant,
    busPositive,
    buSsafety,
    busDongtai,
    busBasic,
    busInform
  },
  name: "index.vue",

  data() {
    return {
      sortId: "",
      activeId: "",
      navList: [],
      sonList: [],
      id1: "",
      id2: "",
      id3: "",
      id4: "",
      id5: "",
      id6: "",
      id7: "",
      id8: "",
      id9: "",
      count: 0
    };
  },
  mounted() {
    this.$api
      .getPermissionOne({
        parentId: this.$route.query.id,
        page: 1,
        limit: 10
      })
      .then(res => {
        this.navList = res.data.data;
        this.id1 = this.navList[0][0].sortId;
        this.activeId = this.id1;
        this.id2 = this.navList[1][0].sortId;
        this.id3 = this.navList[2][0].sortId;
        this.id4 = this.navList[3][0].sortId;
        this.id5 = this.navList[4][0].sortId;
        this.id6 = this.navList[5][0].sortId;
        if (this.navList[6].length != 0) {
          this.id7 = this.navList[6][0].sortId;
        }
        this.id8 = this.navList[7][0].sortId;
        this.id9 = this.navList[8][0].sortId;
        // this.sortId = this.navList[0][0].sortId;
        this.handSonNav(this.id1);
      });
  },
  methods: {
    handSonNav(id, page, limit) {
      this.activeId = id;
      this.$api
        .getList({
          sortId: id,
          page: page == undefined ? "1" : page,
          limit: 10
        })
        .then(res => {
          this.sonList = res.data.data;
          this.sonList.forEach(item => {
            item.img = item.img.replace(/\\/g, "/");
            // this.$store.commit("handBus", false);
            this.count = parseInt(res.data.count);
            // item.img = this.$store.state.baseUrl + item.img;
          });
        });
    }
  }
};
</script>

<style lang='scss' scoped>
.brief_content_box {
  // display: flex;
  margin-top: 10px;
  .brief_content_left {
    width: 261px;
    background: rgba(255, 255, 255, 1);
    .brief_left_serve {
      margin-top: 20px;
      .serve_box {
        border: 1px solid rgba(204, 204, 204, 1);
        border-top: 0;
        padding: 40px 29px 0 29px;
        .the_phone {
          display: flex;
          align-items: center;
          margin-top: 38px;
          margin-bottom: 40px;
          .the_phone_off {
            width: 53px;
            height: 1px;
            // border: 1px solid rgba(204, 204, 204, 1);
            background-color: rgba(204, 204, 204, 1);
          }
          .the_phone_title {
            font-size: 14px;
            font-weight: 400;
            margin-right: 10px;
            margin-left: 10px;
            color: rgba(128, 128, 128, 1);
          }
        }
        .serve_phone_box {
          display: flex;
          align-items: center;
          .phone_num_box {
            margin-left: 21px;
            .phone_num {
              color: #808080;
              font-size: 18px;
            }
          }

          .serve_phone {
            width: 51px;
            height: 51px;
            background: rgba(255, 255, 255, 1);
            border: 2px solid rgba(18, 150, 219, 1);
            border-radius: 50%;
            position: relative;
            .phone_img {
              width: 25px;
              height: 25px;
              position: absolute;
              top: 50%;
              left: 50%;
              margin-top: -12.5px;
              margin-left: -12.5px;
            }
          }
        }
      }
    }
    .brief_left_content {
      // height: 162px;
      border: 1px solid rgba(204, 204, 204, 1);
      border-top: 0;
      width: 100%;
      padding-right: 13px;
      padding-left: 13px;
      .content_list {
        margin-bottom: 20px;
        .content_item {
          width: 100%;
          padding-top: 15px;
          padding-bottom: 15px;
          border-bottom: 1px solid #eeeeee;
          text-align: center;
          color: #333333;
          font-size: 16px;
        }
      }
    }
  }
}
</style>
